package nyist.media.bean.admin;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import nyist.media.entity.admin.Admin;
import nyist.media.entity.admin.Role;

/**
 * @author dcf
 * @date 2018/12/23
 */
@Getter
@Setter
@NoArgsConstructor
public class AdminInfoBean extends AdminListBean {
    private static final long serialVersionUID = -2750954330089277455L;

    private Long[] roleIds;

    /**
     * 密码， 只在添加、更新的时候用到
     */
    private String pwd;

    public AdminInfoBean(Admin admin) {
        super(admin);
        this.roleIds = admin.getRoles().stream().map(Role::getId).toArray(Long[]::new);
    }
}
